# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-construct
pkgver=2.10.68
pkgrel=2
pkgdesc="A powerful declarative parser/builder for binary data"
arch=('any')
license=('MIT')
url="https://construct.readthedocs.org"
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-arrow' 'python-cloudpickle' 'python-lz4' 'python-numpy' 'python-pytest-runner'
              'python-pytest-benchmark' 'python-ruamel-yaml')
optdepends=('python-arrow: for Timestamp'
            'python-numpy: for array serialization with Numpy protocol'
            'python-ruamel-yaml: for KaitaiStruct (KSY) exporter')
source=("$pkgname-$pkgver.tar.gz::https://github.com/construct/construct/archive/v$pkgver.tar.gz")
sha512sums=('2388751323b16b69a06457c4862e7d1334580c201050734f150ab4437e2066ed18ff5323f7d81b8bb93124ae0f57a2ae91d7c64ffefc6e0369d6e625b7fef4eb')

build() {
  cd construct-$pkgver
  python setup.py build
}

check() {
  cd construct-$pkgver
  python setup.py pytest
}

package() {
  cd construct-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
